﻿<%@ Page Title="ClipoWeb" Language="C#" MasterPageFile="~/MasterPage.master" ValidateRequest="false" AutoEventWireup="true" CodeFile="clipboard.aspx.cs" Inherits="Clipboard" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
	<link href="../CSS/clipboard.css" rel="stylesheet" type="text/css" />
	<script src="../Scripts/jquery-1.3.2.js" type="text/javascript"></script>

	<script type="text/javascript">
		function CopyToClipboard(inElement)
		{
			var textElement = document.createElement('textarea')
			textElement.innerText = inElement.innerText
			if (textElement.createTextRange)
			{
				var range = textElement.createTextRange();
				if (range)
				{
					range.execCommand('RemoveFormat');
					range.execCommand('Copy');
				}
			} else
			{
				var flashcopier = 'flashcopier';
				if (!document.getElementById(flashcopier))
				{
					var divholder = document.createElement('div');
					divholder.id = flashcopier;
					document.body.appendChild(divholder);
				}
				document.getElementById(flashcopier).innerHTML = '';
				var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard=' + encodeURIComponent(inElement.value) + '" width="0" height="0" type="application/x-shockwave-flash"></embed>';
				document.getElementById(flashcopier).innerHTML = divinfo;
			}
		}

		function DeleteFromClipboard(inElement)
		{
		}

		$(document).ready(function ()
		{
			$(".expand", this).click(function (event)
			{
				$("#ClipboardContent_" + this.id).addClass("expanded");
			});
		});    
	</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="centerPlaceHolder" Runat="Server">

	Use the text area below to copy text:
    <asp:TextBox CssClass="textarea" id="text" runat="server" Rows="8" TextMode="MultiLine"></asp:TextBox>
	<asp:ImageButton CssClass="button" ID="sendButton" runat="server" AlternateText="right arrow" OnClick="sendButton_Click" ImageUrl="~/Images/send.png" />
    <br/>

	Or use the file upload control to transfer files:
    <asp:FileUpload CssClass="textarea" ID="fileUpload" runat="server" />
	<asp:ImageButton CssClass="button" ID="uploadButton" runat="server" AlternateText="disk" ImageUrl="~/Images/save.png" OnClick="uploadButton_Click"/>

    <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
			<asp:Label CssClass="error" ID="message" runat="server" Text=""></asp:Label>

            <asp:Timer ID="timer" runat="server" Interval="5000" ontick="RefreshContent_Click"></asp:Timer>

            <div class="last-refresh">
                <img alt="clock" runat="server" src="~/images/clock.png" /> <asp:Label ID="lastRefresh" runat="server" Text=""></asp:Label>
            </div>

			<div class="clipboard">
	                <asp:DataList ID="dataList" runat="server" CssClass="clipboard">
	                    <ItemTemplate>
						    <div class="clipboard-item">
								<div class="box-container">
								    <div class="rounded box">
									    <div class="top"><span></span></div>
									    <div class="content">											
										    <h1> <img alt="<%# Eval("ContentType") %>" src="../images/<%# Eval("ContentType") %>.png" /> 
												<%# Eval("ContentType") %> 
												<span class="date-time"><%# Eval("Date") %></span> 
												<span class="clipboard-toolbar">
													<span class="clipboard-command copy" onclick="CopyToClipboard(this.parentElement.parentElement.parentElement.children(1));"><img runat="server" alt="copy" src="~/images/copy.png" /></span> 
													<asp:LinkButton id="deleteButton" runat="server" OnClick="deleteButton_Click" CssClass="clipboard-command" CommandArgument='<%# Eval("Id") %>'><img runat="server" alt="delete" src="~/images/delete.png" /></asp:LinkButton>
													<!--<span id="<%# Eval("Id") %>" class="clipboard-command expand"><img runat="server" alt="box" src="~/images/expand.png" /></span>-->
												</span>
											</h1>
											    <ul id="ClipboardContent_<%# Eval("Id") %>">
							                        <li class="first">
														<div class="clipboard-item-inner">
<%#Eval("Html")%>
														</div>
													</li>
							                    </ul>
							            </div>
									    <div class="bottom"><span></span></div>
								    </div> 	    
								</div>
						    </div>
	                    </ItemTemplate>
	                </asp:DataList>
			</div>
        </ContentTemplate>        
    </asp:UpdatePanel>

</asp:Content>


<asp:Content ID="Content3" ContentPlaceHolderID="rightPlaceHolder" Runat="Server">
    <div class="sidebar" style="min-width: 150px">
        <div class="rounded box">
	        <div class="top"><span></span></div>
	        <div class="content">
		        <h1>Clipboard</h1>
			        <ul>
						<li class="first"><asp:LinkButton runat="server" OnClick="EmptyContent_Click" CssClass="clipboard-command"><img alt="garbage" runat="server" src="~/images/empty.png" /> Empty</asp:LinkButton></li>
						<li><asp:LinkButton runat="server" OnClick="RefreshContent_Click" CssClass="clipboard-command"><img alt="refresh" runat="server" src="~/images/refresh.png" /> Refresh</asp:LinkButton></li>
						<li><asp:LinkButton runat="server" CssClass="clipboard-command" PostBackUrl="~/Clipboard/configuration.aspx"><img alt="gear" runat="server" src="~/images/configuration.png" /> Configuration</asp:LinkButton></li>
			        </ul>
	        </div>
	        <div class="bottom"><span></span></div>
        </div>
    </div>       
</asp:Content>